.el-header {
    height: 60px;
    width: 100%;
}

.el-aside {
    background-color: white;
    color: #333;
    text-align: center;
    line-height: 200px;
    width: 200px;
}

.main-container {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
    color: #333;
    font-size: 20px;
    padding: 0px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* 搜索框区域样式 */
.sidebar-content {
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 240px;
    border-right: 1px solid #eee;
    overflow: hidden;
    height: calc(100vh - 60px);
}

.search-section {
    height: 60px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.search-box {
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
}

.search-input {
    border-radius: 20px;

}

/* 联系人列表样式 */
.contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0;
    max-height: calc(100% - 60px);
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.contact-item:hover {
    background-color: #f5f5f5;
}

.contact-item.active {
    background-color: #e6f7ff;
}

.contact-avatar {
    position: relative;
    margin-right: 10px;
}

.online-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #52c41a;
    border-radius: 50%;
    border: 2px solid white;
}

.offline-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #bfbfbf;
    border-radius: 50%;
    border: 2px solid white;
}

/* 在线/离线文本样式 */
.online-text {
    color: #52c41a;
    font-size: 12px;
    margin-left: 5px;
}

.offline-text {
    color: #bfbfbf;
    font-size: 12px;
    margin-left: 5px;
}

.contact-info-wrapper {
    flex: 1;
    display: flex;
    justify-content: space-between;
    min-width: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.last-message {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 60px;
}

.unread-badge {
    background-color: #ff4d4f;
    color: white;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    transition: opacity 0.2s;
}

.hidden-badge {
    opacity: 0;
    pointer-events: none;
}

/* 右侧聊天区域容器 */
.chat-right-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 聊天容器样式强化 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.chat-header {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    margin-left: 10px;
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.chat-status {
    font-size: 12px;
    color: #999;
}

.online-indicator {
    color: #52c41a;
    margin-right: 3px;
}

.chat-header-actions {
    display: flex;
}

.chat-header-actions .el-button {
    margin-left: 5px;
    color: #606266;
    transition: all 0.2s;
}

.chat-header-actions .el-button:hover {
    color: #1890ff;
}

.message-list {
  scroll-behavior: smooth;
  overflow-y: auto;
  padding: 15px;
  background-color: #f5f7fa;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.message-date-separator {
    text-align: center;
    margin: 15px 0;
}

.message-date-separator span {
    display: inline-block;
    background-color: #e4e6eb;
    color: #606266;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
}

.system-message {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin: auto 0;
}/* 消息项容器*/
.message-item {
  display: flex;
  margin-bottom: 12px;
  max-width: 100%;
  width: 100%;
  align-items: flex-end; /* 头像与气泡底部对齐 */
}

/* 发送的消息 - 靠右对齐 */
.message-item.sent {
  justify-content: flex-end;
  padding-right: 16px;
}

/* 接收的消息 - 靠左对齐 */
.message-item.received {
  justify-content: flex-start;
  padding-left: 16px;
}

/* 头像样式 - 固定大小，确保与气泡紧凑排列 */
.message-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0; /* 防止头像被压缩 */
}

/* 发送方头像位置 - 气泡右侧，贴近气泡 */
.message-item.sent .message-avatar {
  margin-left: 8px; /* 头像与气泡的间距 */
  order: 2; /* 头像放在气泡后面 */
}

/* 接收方头像位置 - 气泡左侧，贴近气泡（修复核心） */
.message-item.received .message-avatar {
  margin-right: 8px; /* 头像与气泡的间距 */
  order: 1; /* 头像放在气泡前面 */
}

/* 消息内容容器（修复核心） */
.message-content-wrapper {
  display: inline-block;
  max-width: calc(100% - 100px); /* 为头像和边距预留空间 */
}

/* 接收方消息内容容器 - 确保在头像右侧 */
.message-item.received .message-content-wrapper {
  order: 2; /* 内容放在头像后面 */
}

/* 聊天气泡基础样式 */
.message-bubble {
  padding: 8px 12px;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
}

/* 发送方气泡 */
.message-item.sent .message-bubble {
  background-color: #1890ff;
  color: white; /* 改为白色文字，与蓝色背景更搭配 */
  border-top-right-radius: 4px; /* 右上角略平 */
  margin: 0;
}

/* 发送气泡的小三角*/
.message-item.sent .message-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent #1890ff transparent transparent;
}

/* 接收方气泡 */
.message-item.received .message-bubble {
  background-color: #fff;
  color: #333;
  border: 1px solid #e5e5ea;
  border-top-left-radius: 4px; /* 左上角略平 */
  margin: 0;
}

/* 接收气泡的小三角  */
.message-item.received .message-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 0;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}

/* 消息文字样式 */
.message-text {
  font-size: 14px;
  line-height: 1.4;
}

/* 消息时间样式 */
.message-time {
  font-size: 10px;
  margin-top: 4px;
  text-align: right;
}

/* 发送方时间颜色适配 */
.message-item.sent .message-time {
  color: rgba(255, 255, 255, 0.8);
}

/* 接收方时间颜色 */
.message-item.received .message-time {
  color: #888;
}

/* 消息输入区固定在底部 */
.message-input-area {
    padding: 10px 10px;
    border-top: 1px solid #eee;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-bottom: 0;
}

.message-input-actions {
    display: flex;
    margin-bottom: 8px;
}

.message-input-actions .el-button {
    margin-right: 10px;
    color: #606266;
    transition: all 0.2s;
}

.message-input-actions .el-button:hover {
    color: #1890ff;
}

.message-input {
    margin-bottom: 10px;
    border-radius: 4px;
}

.message-input textarea {
    min-height: 60px;
    max-height: 200px;
    resize: vertical;
}

.input-wrapper {
    transition: all 0.3s ease-out;
    max-height: 200px;
    overflow: hidden;
    opacity: 1;
}

.input-wrapper.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.toggle-input-btn {
    order: -1;
    margin-right: 5px;
}

.input-wrapper {
    width: 100%;
}

.message-send-action {
    display: flex;
    justify-content: flex-end;
}

.send-button {
    text-align: center;
    border-radius: 4px;
    padding: 8px 20px;
}

.no-contact-selected {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
}

.empty-chat-container {
    text-align: center;
}

.empty-icon {
    font-size: 80px;
    color: #e4e6eb;
    margin-bottom: 20px;
}

.empty-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.empty-subtitle {
    font-size: 14px;
    color: #909399;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
